package com.yunxi.service.dubboService.impl.basedata;

import com.github.pagehelper.PageInfo;
import com.yunxi.basedata.pojo.CompanyVO;
import com.yunxi.basedata.service.CompanyDubboService;
import com.yunxi.model.company.Company;
import com.yunxi.service.localService.company.CompanyService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 公司信息 服务实现类
 * </p>
 *
 * @author 
 * @since 2019-05-21
 */
public class CompanyDubboServiceImpl implements CompanyDubboService {

    @Autowired
    @Qualifier(value = "companyServiceImpl")
    CompanyService companyService;


    @Override
    public CompanyVO getById(String id) throws InvocationTargetException, IllegalAccessException {
    Company company = companyService.getById(id);
    CompanyVO companyVO = new CompanyVO();
        BeanUtils.copyProperties(company,companyVO);
        return companyVO;
    }

    @Override
    public void saveOrUpdate(CompanyVO companyVO) throws InvocationTargetException, IllegalAccessException {
    Company company = new Company();
        BeanUtils.copyProperties(companyVO,company);
    companyService.saveOrUpdate(company);
    }

    @Override
    public void removeById(String id) {
    companyService.removeById(id);
    }

    @Override
    public PageInfo<CompanyVO> findPageByVO(CompanyVO companyVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {

      PageInfo<CompanyVO> pageInfo = companyService.pageByVo(companyVO,pageNum,pageSize);

      return pageInfo;

   }

    @Override
    public List listByVO(CompanyVO companyVO) {
        return companyService.listByVo(companyVO);
    }

    @Override
    public void removeByListVo(List<CompanyVO> companyVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        companyService.removeByListVo(companyVOList);
    }

}
